function add(a,b=1){
    if (a == 0){
        throw new Error('a should not equal 0!');
        
    }
    return a+b;
}

console.log(add(1,2));
console.log(add(1));
//console.log(add(0));

//箭头函数
var add1=(a,b=1) => a+b;
console.log(add1(11));

var add2=(a,b=1) => {
    console.log("多行;");
    return a+b;
}
console.log(add2(2));